<?php

/**
 *  +---------------------------------------------------------------------- 
 *  | 文件功能：基础模型，可实现模型通用方法
 *  +---------------------------------------------------------------------- 
 *  | Copyright (c) 2022~2024 https://www.huihuiv.com All rights reserved.
 *  +---------------------------------------------------------------------- 
 *  | Create At: 2024年02月26日 18:11:06
 *  +---------------------------------------------------------------------- 
 *  | Author: 半壶水 <star@cqshanwen.com>
 *  +---------------------------------------------------------------------- 
 */

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class BaseModel extends Model
{
    use HasFactory;

    // 自动时间戳
    public $timestamps = true;

    // 时间戳格式
    protected $dateFormat = 'U';

    // 返回时间格式
    public function serializeDate($value)
    {
        return date('Y-m-d', strtotime((string)$value));
    }
}
